﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Mooc
{
    public partial class UpdateWork : Form
    {
        public UpdateWork(Work work, TeaApp teaApp)
        {
            InitializeComponent();
            this.work = work;
            content.Text = work.W_content;
            this.teaApp = teaApp;
        }
        TeaApp teaApp;

        Work work;

        SqlDao sqlDao = new SqlDao();
        private void submit_Click(object sender, EventArgs e)
        {
            if (comment.Text == "" || score.Text == "")
            {
                MessageBox.Show("分数和评语不能为空...");
            }
            else
            {
                work.W_state = 1;
                work.W_comment = comment.Text;
                work.W_score = score.Text;
                if (sqlDao.updateWork(work))
                {
                    MessageBox.Show("提交成功...");
                    teaApp.delete();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("提交失败...");
                }
            }
        }
    }
}
